using System;
using UnityEngine;

public class BaseWindow : MonoBehaviour
{
	[NonSerialized]
	public bool isShow = true;

	protected UIPanel _panel;

	public bool isVisible
	{
		get
		{
			if (_panel == null)
			{
				GetPanel();
			}
			if (_panel != null)
			{
				return _panel.enabled;
			}
			return false;
		}
		set
		{
			if (_panel == null)
			{
				GetPanel();
			}
			if (_panel != null)
			{
				_panel.enabled = value;
			}
		}
	}

	private void Awake()
	{
	}

	private void GetPanel()
	{
		_panel = GetComponent<UIPanel>();
	}

	public virtual void Hide()
	{
		WindowManager.instance.HideWindow(this);
	}

	public virtual void OnInit()
	{
	}

	public virtual void OnPreShow(object userData = null)
	{
	}

	public virtual void OnShow(object userData = null)
	{
	}

	public virtual void OnHide()
	{
	}
}
